/**
 *	VisualGroup JavaScript prototype Classes, version 0.1
 *  (c) 2008 Bill Vison <vison_ruan@126.com>
 *
 *
/*--------------------------------------------------------------------------*/
using("Vsg.CrossDomainAction");
using("Vsg.FlashRemoteHandler.Submit");
using("Vsg.FlashRemoteHandler.Load");

Vsg.FlashRemoteProxy = {
	// defined the same flash object
	_flashObj:null,
	
	_handler:null,
	
	flash_debug:function($obj) {
		Ext.log($obj);
	},
	
	flash_reponseHandle:function ($obj) {

		var $success = $obj.success;
		
		if ($success) {
			
			this._handler.flashResponseHandler($obj);
			
		} else {
			//$action.setResponse(  );
			
			
		}
	
	},
	
	registFlashObj:function($flashObj) {
		this._flashObj = $flashObj;
	},
	
	submit:function($handlerName , $form , $opt) {
		// --- defined handler load ---

		if ($handlerName == "submit") {
			this._handler = new Vsg.FlashRemoteHandler.Submit({form:$form , options:$opt , flashProxy:this._flashObj});
		} else if ($handlerName == "load") {
			this._handler = new Vsg.FlashRemoteHandler.Load({form:$form , options:$opt ,  flashProxy:this._flashObj});
		} else {
			// --- throw a not support handler 
			Ext.log("[Vsg.FlashRemoteProxy],找不到支持的方法!");
		}

		this._handler.doAction();
	}
}
